\section{tril --- lower triangular matrix}
\label{fn:tril}
\index{tril()}
\index{matrix!lower triangular part}
\index{lower triangular matrix}
\begin{rail}
Tril : 'tril' '(' Matrix (',' Scalar)? ')' ;
\end{rail}

\verb+tril+ returns the lower triangular part of the argument matrix.
If no scalar argument is present, this is all the terms on the main diagonal 
and below. The remainder of the matrix is set to zero. If the optional 
scalar argument is present, then it specifies the diagonal to use instead
of the main diagonal.  The convention used is that positive values are
above the main diagonal, negative values are below the main diagonal, and
zero is the main diagonal.

$\Longrightarrow$ This is not an \RLaB\ built-in function.  This function
is normally loaded on start-up from the \verb+tril.r+ file in the
standard \verb+rlib+ directory. Use of the \verb+-r+ option, incorrectly 
setting the \verb+RLAB_LIB_DIR+ environmental variable, or modifying
\verb+tril.r+ may make this function unavailable.


\paragraph{Example}
\index{example of tril()}
\index{tril()!example}
\begin{verbatim}
> b = rand(3,5)
 b =
        1      0.333      0.665      0.167       0.91  
    0.975     0.0369     0.0847      0.655      0.112  
    0.647      0.162      0.204      0.129      0.299  
> tril(b)
        1          0          0          0          0  
    0.975     0.0369          0          0          0  
    0.647      0.162      0.204          0          0  
> tril(b,1)
        1      0.333          0          0          0  
    0.975     0.0369     0.0847          0          0  
    0.647      0.162      0.204      0.129          0  
> tril(b,3)
        1      0.333      0.665      0.167          0  
    0.975     0.0369     0.0847      0.655      0.112  
    0.647      0.162      0.204      0.129      0.299
> tril(b,-1)
        0          0          0          0          0  
    0.975          0          0          0          0  
    0.647      0.162          0          0          0  
\end{verbatim}

See also: Page~\pageref{fn:triu} \verb+triu()+.

\newpage



